package com.hackintosh.dating;

/**
 * @description：
 * @author：twislyn
 * @date：Created in 2021/06/06
 * @modified By：
 * @version: 1.0
 */
public class GirlStack {
    private Girl girl[];
    private int top;

    public GirlStack() {
        girl = new Girl[5];
        top = -1;
    }

    public boolean push(Girl g) {
        if (top > 3) {
            System.out.println("你太花心了，变来变去的！");
            return false;
        }
        girl[++top] = g;
        return true;
    }

    public Girl pop() {
        if (top <= 0) {
            System.out.println("美女栈空了！");
            return girl[0];
        }
        return girl[top--];
    }
}
